package tech.yunland.shop.domain.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.moyuer.bsf.domain.model.AbstractEntity;
import com.moyuer.bsf.domain.model.Organ;
import com.moyuer.bsf.domain.model.User;

import javax.persistence.*;
import java.util.Date;

/**
 * 微信群发记录
 *
 * @author 文卡<wkwenka@gmail.com>  on 17-3-4.
 */
@Entity
@Table(name = "mess_send_record")
public class MessSendRecord extends AbstractEntity {

    @Column(length = 30)
    private String author; //作者

    @Column(nullable = false, length = 100)
    private String title; //标题

    @Column(nullable = false)
    private String content_source_url; //内容地址

    private String digest; //图文消息描述

    @Column(nullable = false)
    private String show_cover_pic; //显示封面 1:显示 0：隐藏

    private String thumb_media_id; //缩略图

    private String content; //内容

    @Column(name = "create_time", nullable = false)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime = new Date(); //创建日期

    @ManyToOne
    private Organ organ;

    @ManyToOne
    private User creator;

    @Transient
    private String creatorName;

    @Transient
    private String organName;

    private Integer state; //状态 -1:删除 0:未启用  1:启用

    private String message; // 发送结果消息


    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent_source_url() {
        return content_source_url;
    }

    public void setContent_source_url(String content_source_url) {
        this.content_source_url = content_source_url;
    }

    public String getDigest() {
        return digest;
    }

    public void setDigest(String digest) {
        this.digest = digest;
    }

    public String getShow_cover_pic() {
        return show_cover_pic;
    }

    public void setShow_cover_pic(String show_cover_pic) {
        this.show_cover_pic = show_cover_pic;
    }

    public String getThumb_media_id() {
        return thumb_media_id;
    }

    public void setThumb_media_id(String thumb_media_id) {
        this.thumb_media_id = thumb_media_id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Organ getOrgan() {
        return organ;
    }

    public void setOrgan(Organ organ) {
        this.organ = organ;
    }

    public User getCreator() {
        return creator;
    }

    public void setCreator(User creator) {
        this.creator = creator;
    }

    public String getCreatorName() {
        return creator != null ? creator.getName() : "";
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    public String getOrganName() {
        return this.organ != null ? this.organ.getName() : "";
    }

    public void setOrganName(String organName) {
        this.organName = organName;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
